


import java.awt.*;
import javax.swing.*;

/**
 * Template for views consiting of a top, content (middle) and bottom section.
 */
public class MainTemplatePanel extends ObservingJPanel {
    
    protected JPanel top;
    protected ObservingJPanel content;
    protected JPanel bottom;
    
    protected CalendarController controller;

    
    public MainTemplatePanel(CalendarController controller, JPanel content) {
        this.setLayout(new BorderLayout());
        this.controller = controller;
        
		// Create panels
        top = new TopMenuPanel(controller);
        this.content = (ObservingJPanel) content;
        content.setBackground(Color.WHITE);
        bottom = new BottomPanel(controller);

		this.add(top, BorderLayout.PAGE_START);
		this.add(content, BorderLayout.CENTER);
		this.add(bottom, BorderLayout.PAGE_END);
	}

    public void setTitle(String s) {
        // lol
        TopMenuPanel t = (TopMenuPanel) top;
        t.setTitle(s);
    }
    
    public void setBottom(JPanel bottom) {
        this.bottom = bottom;
    }

    public void setContent(ObservingJPanel content) {
        this.content = content;
    }

    public void setTop(JPanel top) {
        this.top = top;
    }

    @Override
    public void update() {
        try {
            content.update();
        } catch (Exception e) {}
    }
}

